# Maintainer: Sven-Hendrik Haase <svenstaro@archlinux.org>
# Contributor: robertfoster

# ALARM: Kevin Mihelich <kevin@archlinuxarm.org>
#  - removed --enable-x86-rtcd from configure
#  - upstream patch to fix FTBFS

pkgname=rnnoise
epoch=1
pkgver=0.2
pkgrel=1
pkgdesc="A noise suppression library based on a recurrent neural network"
arch=(x86_64)
url="https://gitlab.xiph.org/xiph/rnnoise"
license=('BSD-3-Clause')
depends=('glibc')
makedepends=('wget')
source=("https://gitlab.xiph.org/xiph/rnnoise/-/archive/v${pkgver}/rnnoise-v${pkgver}.tar.gz"
        "https://gitlab.xiph.org/xiph/rnnoise/-/commit/372f7b4b76cde4ca1ec4605353dd17898a99de38.patch")
sha512sums=('930aa892299edbc1d512803df6b845ea6164eb498cacdab9970e5ae799bc6cf3c8c94d2b9576955fb9a2d8aa13a6d255e58fb99d0367a0d0ef842a1cb938e674'
            '5f841d2971b66cc4ac492857975aee2d00b6d16defd5aaad00b4dc3ff697a3a426dff24406483a0fdf85594de61ae6a99d02e57bf931544e88948fdc724184f4')

prepare() {
  cd "rnnoise-v${pkgver}"
  patch -p1 -i ../372f7b4b76cde4ca1ec4605353dd17898a99de38.patch
}

build() {
  cd "rnnoise-v${pkgver}"
  ./autogen.sh
  ./configure --prefix=/usr
  make
}

package() {
  cd "rnnoise-v${pkgver}"
  make DESTDIR="$pkgdir/" install
  install -Dm644 COPYING "${pkgdir}/usr/share/licenses/${pkgname}/COPYING"
}
